﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace BLL.SysManage
{
    public class T_PUB_HOTEL
    {
        private readonly DALL.SysManage.T_PUB_HOTEL dal = new DALL.SysManage.T_PUB_HOTEL();
        public T_PUB_HOTEL()
        { }

        /// <summary>
        /// 智能提示酒店名称
        /// </summary>
        /// <returns></returns>
        public DataSet GetHotelName()
        {
            return dal.GetHotelName();
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetHotelList(string txtName, int bid, string flag)
        {
            string strWhere = "0 < 1";
            if (!string.IsNullOrEmpty(txtName))
            {
                strWhere += string.Format(" and HOTEL_NAME like '%{0}%'", txtName);
            }
            if (flag != "-1")
            {
                if (flag == "0")
                {
                    strWhere += string.Format(" and BRANCH_ID = '{0}'", bid);
                }
                else if(flag == "1")
                {
                    strWhere += string.Format(" and BRANCH_ID <> '{0}'", bid);
                }
            }
            return dal.GetList(strWhere);
        }

        #region  Method
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Model.SysManage.T_PUB_HOTEL model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.SysManage.T_PUB_HOTEL model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(string HOTEL_ID)
        {

            return dal.Delete(HOTEL_ID);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.SysManage.T_PUB_HOTEL GetModel(string HOTEL_ID)
        {

            return dal.GetModel(HOTEL_ID);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Model.SysManage.T_PUB_HOTEL> GetModelList(string strWhere)
        {
            return dal.GetListArray(strWhere);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        #endregion  Method
    }
}
